<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<h4 align="center">所有商品</h4>
	<table border="1" cellpadding="3" cellspacing="0" align="center">
		<tr>
			<th>ID</th>
			<th>商品名称</th>
			<th>价格</th>
			<th>库存</th>
			<th>状态</th>
			<th>操作</th>
		</tr>
		<c:forEach items="${requestScope.goods }" var="g">
			<tr>
				<td>${g.goodsId }</td>
				<td>${g.goodsName }</td>
				<td>${g.price }</td>
				<td>${g.quantity }</td>
				<td>${g.states }</td>
				<td>
					<a href="${pageContext.request.contextPath }/goods/edit/${g.goodsId}">修改</a>
					<a href="${pageContext.request.contextPath }/goods/deleteGoods/${g.goodsId}">删除</a>
					<c:if test="${g.states=='上架'}">
						<a href="${pageContext.request.contextPath }/goods/putDown/${g.goodsId}">下架此商品</a>
					</c:if>
					<c:if test="${g.states=='下架'}">
						<a href="${pageContext.request.contextPath }/goods/putDown/${g.goodsId}">上架此商品</a>
					</c:if>
				</td>
			</tr>
		</c:forEach>
	</table>
	<table align="center">
	<tr>
		<td>
			<form action="${pageContext.request.contextPath }/goods/inputGoods" method="post"
			 style="width: 30%; margin: auto">
				<input type="submit" value="录入">
			</form>
		</td>
		<td>
			<form action="${pageContext.request.contextPath }/goods/inputCondition" method="post"
			 style="width: 30%; margin: auto">
				<input type="submit" value="查询">
			</form>
		</td>
		<td>
		<form action="${pageContext.request.contextPath }/contract/toPage/login/storeAdminPage" method="post"
		 style="width: 30%; margin: auto">
			<input type="submit" value="返回">
		</form>
		</td>
	</tr>
	</table>
</body>
</html>